#include "diskTest.h"

#ifndef _DEBUG
#       define EXIT_STATUE 1
#       define gdb_stop()
#else
#       define exit(_nil) abort()
        static void gdb_stop(void) {}
#endif


void error_s(char *say) {
        if (opt.logLevel != 0) {
                fputs(say, stderr);
                fputc('\n', stderr);
        }
}

void error_se(char *say) {
        error_s(say);
        gdb_stop();
        exit(EXIT_STATUE);
}

void opt_err(void) {
        error_se(_("Option Err"));
}

void perr_e(char *say) {
        if (opt.logLevel != 0)
                perror(say);
        gdb_stop();
        exit(EXIT_STATUE);
}

void *malloc_se(size_t s) {
        void *ret = malloc(s);
        if (ret == NULL)
                error_se(_("Malloc Err"));
        return ret;
}

#ifdef _GUI
bool thrd_se(thrd_t *tid, int(*func)(void *), void *ptr) {
        return (thrd_create(tid, func, ptr) == thrd_success);
}
#endif // _GUI
